/*
 * PayloadMessage.h
 *
 *  Created on: 25.06.2011
 *      Author: mario
 */

#ifndef PAYLOADMESSAGE_H_
#define PAYLOADMESSAGE_H_

#include "ariba/ariba.h"

using_serialization;

class PayloadMessage : public ariba::Message
{
  VSERIALIZEABLE;
public:
    PayloadMessage()
    {
    }
    
    PayloadMessage(string key, uint32_t size, uint64_t pos)  :
        key(key),
        size(size),
        pos(pos)
    {
    }

    virtual ~PayloadMessage()
    {
    }

public:
    string key;
    uint32_t size;
    uint64_t pos;
};

sznBeginDefault(PayloadMessage, X)
{
    X && size && pos && T(key);
    
    // XXX little hack to work with old messages on the receiving side..
    if ( X.isDeserializer() )
    {
        X && Payload(size);
    }
    
} sznEnd();

#endif /* PAYLOADMESSAGE_H_ */
